﻿using System;

using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Techstar.MBHOP.Controls
{
    internal class ItemIconList
    {
        private List<ItemIcon> iconList = null;
        public List<ItemIcon> IconList
        {
            get
            {
                return iconList;
            }
        }

        public ItemIconList()
        {
            iconList = new List<ItemIcon>();
        }

        public Image this[ItemSelectStateEnum selectState, int iconIndex]
        {
            get
            {
                foreach (ItemIcon itemIcon in iconList)
                {
                    if (itemIcon.IconIndex == iconIndex && itemIcon.SelectState == selectState)
                    {
                        return itemIcon.Icon;
                    }
                }
                return null;
            }
        }

        public void Add(Image icon, ItemSelectStateEnum selectState, int iconIndex)
        {
            if (this[selectState, iconIndex] == null)
                iconList.Add(new ItemIcon(icon, selectState, iconIndex));
        }

        public void Clear()
        {
            iconList.Clear();
        }
    }

    internal class ItemIcon
    {
        public ItemIcon(Image icon, ItemSelectStateEnum selectState, int iconIndex)
        {
            this.icon = icon;
            this.selectState = selectState;
            this.iconIndex = iconIndex;
        }

        private Image icon = null;
        public Image Icon
        {
            get
            {
                return icon;
            }
            set
            {
                icon = value;
            }
        }

        private ItemSelectStateEnum selectState = ItemSelectStateEnum.Up;
        public ItemSelectStateEnum SelectState
        {
            get
            {
                return selectState;
            }
            set
            {
                selectState = value;
            }

        }

        private int iconIndex = 0;
        public int IconIndex
        {
            get
            {
                return iconIndex;
            }
            set
            {
                iconIndex = value;
            }
        }
    }
}
